import request from '@/utils/request'

export function listMerchandise(query) {
  return request({
    url: '/merchandise/list',
    method: 'get',
    params: query
  })
}

export function deleteMerchandise(id) {
  return request({
    url: '/merchandise/delete',
    method: 'delete',
    params: { id }
  })
}

export function editMerchandise(data) {
  return request({
    url: '/merchandise/update',
    method: 'put',
    data
  })
}

export function createMerchandise(data) {
  return request({
    url: '/merchandise/create',
    method: 'post',
    data
  })
}

export function readMerchandise(id) {
  return request({
    url: '/merchandise/read',
    method: 'get',
    params: { id }
  })
}

export function getMerchandiseRecordList(query) {
  return request({
    url: '/merchandise/merchandiseRecordList',
    method: 'get',
    params: query
  })
}

export function allMerchandise(query) {
  return request({
    url: '/merchandise/all',
    method: 'get',
    params: query
  })
}

export function merchandiseAddNumber(data) {
  return request({
    url: '/merchandise/addNumber',
    method: 'put',
    data
  })
}

export function setShopMerchandiseNumber(data) {
  return request({
    url: '/shopMerchandise/setWarnNumber',
    method: 'post',
    data
  })
}

// 原料汇总统计
export function materialSummaryStatistics(query) {
  return request({
    url: '/merchandise/statistics',
    method: 'get',
    params: query
  })
}

// 店铺原料统计
export function shopMerchandiseStatistics(data) {
  return request({
    url: '/shopMerchandise/statistics',
    method: 'post',
    data
  })
}

// 店铺原料统计
export function shopMerchandiseTotalStatistics(data) {
  return request({
    url: '/shopMerchandise/total-statistics',
    method: 'post',
    data
  })
}
